Oitsm.DeviceDiscoverPanel = Ext.extend(Ext.Panel, {
	layout : 'border',
	border : false,
	initComponent : function(){
		this.builderMenuBar();
		Oitsm.DeviceDiscoverPanel.superclass.initComponent.call(this);
		this.buildContainer();
	},
	
	builderMenuBar : function(){
		this.menuBar = Ext.create("Ext.toolbar.Toolbar", {
			vertical : true,
			width: 94,
			defaults : {
				scale: 'large',
				iconAlign: 'top',
				scope : this
			}
		});
		this.lbar = this.menuBar;
		this.loadMenus();
	},
	
	
	loadMenus : function(){
		Ext.Ajax.request({
			url : webContext + '/discover_getDiscoverMeta.action',
			success : function(response,opts){
				var json = Ext.decode(response.responseText);
				var firstBtn = null;
				for(i=0;i<json.length;i++){
					var menu = json[i];
					var btn = this.menuBar.add({
						xtype : 'button',
						height : 90,
						text : menu.text,
						icon : menu.icon,
						handlerParams : {
							id : menu.id
						},
						handler : this.doAction
					});
					if(firstBtn == null){
						firstBtn = btn;
					}
					this.menuBar.add('-');
				}
				this.menuBar.doLayout();
				if(firstBtn!=null){
					this.doAction(btn);
				}
			},
			failure : function(response,opts){
				Ext.Msg.alert("提示","数据请求失败!");
			},
			scope : this
		});
	},
	
	buildContainer : function(){
		this.containerPanel = Ext.create('Ext.panel.Panel', {
			border : false,
			region : 'center',
			layout : 'fit',
			items : [{html:'asdfasdf',border : false}]
		});
		
		this.add(this.containerPanel);
	},
	
	doAction : function(btn){
		alert(btn.handlerParams.id);
	}
	
});